package com.zygh.questionnairesurvey.controller;

import com.zygh.questionnairesurvey.common.CommonResult;
import com.zygh.questionnairesurvey.entity.UserInfo;
import com.zygh.questionnairesurvey.entity.vo.LoginVO;
import com.zygh.questionnairesurvey.server.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@RestController
@RequestMapping("/system")
@Api(tags = "登录")
public class LoginController {
    @Resource
    private LoginService loginService;

    @PostMapping("/login")
    @ApiOperation(value = "登录")
    public CommonResult login(@Valid @RequestBody LoginVO login) {
        return loginService.login(login);
    }

    @PostMapping("/forbidden")
    @ApiOperation(value = "禁用用户")
    public CommonResult forbidden(@Valid @RequestBody UserInfo userInfo) {
        return loginService.forbidden(userInfo);
    }


}
